<!--
 * @Description:: 请补充填写
 * @Version: 1.0
 * @Author: 小白
 * @Date: 2022-04-14 14:32:34
 * @LastEditors: 小白
 * @LastEditTime: 2025-10-27 16:52:37
 * @FilePath: \tmsadmin\src\views\contract\pushContract\components\search.vue
-->
<template>
  <el-card class="search_card" shadow="never">
    <template #header>
      <div class="card-header">
        <span>条件筛选</span>
      </div>
    </template>
    <el-form :model="form" label-width="100px">
      <el-row>
        <el-col :lg="6" :md="8">
          <el-form-item label="合同模板">
            <!-- 签署状态 -->
             <el-select v-model="form.templateId" placeholder="请选择" @change="changeTemplate">
              <el-option v-for="item in props.list" :key="item.id" :label="item.templateName" :value="item.id"></el-option>
             </el-select>
          </el-form-item>
        </el-col>
        
        <el-col :lg="18" :md="24" style="text-align: right">
          <el-button type="primary" @click="searchFun"> 搜索 </el-button>
          <el-button @click="restFun"> 重置 </el-button>
        </el-col>
      </el-row>
    </el-form>
  </el-card>
</template>
<script lang="ts" setup>
import { onMounted, ref, watch } from 'vue'
const emits = defineEmits(['search'])
const form = ref({
   templateId:''
})
const props = defineProps({
  list: {
    type: Array,
    default: () => [],
  }
})
const changeTemplate = (e:any) => {
form.value.templateId = e
  emits('search',form.value.templateId)

}
onMounted(() => {
  setTimeout(()=>{
    console.log(props.list,'000000')
    form.value.templateId = props.list[0].id
  },500)
  
})
// watch(() => props.list, (newVal) => {
//   form.value.templateId = newVal[0].id
// })
const searchFun = () => {
  emits('search', form.value)
}
const restFun = () => {
  form.value = {
    templateId: ''
  }
  emits('search', form.value)
}
</script>

<style lang="scss" scoped>
// @import '@/style/variables.scss';
.card-header {
  display: flex;
  justify-content: space-between;
  .more_text {
    cursor: pointer;
    color: $color;
  }
}
</style>
